import Request from 'luch-request'
import {netWorkInterceptor} from "../app/interceptor";
import Constants from "../constants";

export const http = new Request({
  baseURL: Constants.BASE_URL,
  timeout: 30 * 1000,
  dataType: 'json',
})

// 请求拦截器
http.interceptors.request.use(
  netWorkInterceptor.request.onFulfilled,
  netWorkInterceptor.request.onRejected
)

// 响应拦截器
http.interceptors.response.use(
  netWorkInterceptor.response.onFulfilled,
  netWorkInterceptor.response.onRejected
)